<template>
  <div id="fileDel">
    <el-dialog title="提示" :visible.sync="deleteObj.isVisible" width="30%">
      <span>确定删除吗？</span>
      <span slot="footer" class="dialog-footer">
            <el-button @click="cancelIt">取 消</el-button>
            <el-button type="primary" @click="deleteSubmit">确 定</el-button>
          </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: ['deleteBox'],
  data () {
    return {
      deleteObj: ''
    }
  },
  created() {
    this.deleteObj = this.deleteBox
  },
  methods: {
    deleteSubmit() {
      let list = this.deleteBox.delData
      console.log("deleteBox", this.deleteBox);
      let ids = []
      list.forEach(v=>{
         ids.push(v.id)
      })
      if (!(ids == false)) {
        this.$http.post("file/del",  {fileId: ids}).then(res => {
          console.log("deleteFun", res);
          if (res.status === 200) {
            this.$emit('clearSelsForDel', this.deleteObj.nodeData)
          }
        });
      }
    },
    cancelIt() {
      this.deleteObj.isVisible = false
      this.$emit("cancleDel");
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
#fileDel {

}
</style>
